//青蛙frog        属性:名字，年龄       行为:吃虫子，喝水
//狗Dog           属性:名字，年龄       行为:吃骨头，喝水
//山羊sheep       属性:名字，年龄       行为:吃草，喝水
public class A53 {
    public static void main(String[] args) {
        Frog frog = new Frog("小青", 1);
        System.out.println(frog.getName() + " " + frog.getAge());
        frog.eat();
        frog.drink();
        Dog dog = new Dog("旺财", 2);
        System.out.println(dog.getName() + " " + dog.getAge());
        dog.eat();
        dog.drink();
        Sheep sheep = new Sheep("小绵羊", 3);
        System.out.println(sheep.getName() + " " + sheep.getAge());
        sheep.eat();
        sheep.drink();
    }
}
abstract class Animal{
    private String name;
    private int age;
    public Animal() {
    }
    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public void drink(){
        System.out.println("在喝水");
    }
    public abstract void eat();
}
class Frog extends Animal{
    public Frog() {
    }
    public Frog(String name, int age) {
        super(name, age);
    }
    @Override
    public void eat() {
        System.out.println("青蛙吃虫子");
    }
}
class Dog extends Animal{
    public Dog() {
    }
    public Dog(String name, int age) {
        super(name, age);
    }
    @Override
    public void eat() {
        System.out.println("狗吃骨头");
    }
}
class Sheep extends Animal{
    public Sheep() {
    }
    public Sheep(String name, int age) {
        super(name, age);
    }
    @Override
    public void eat() {
        System.out.println("山羊吃草");
    }
}